package com.juyu.miliao.api.dao.mysql;

import java.util.*;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.juyu.miliao.api.domain.User;
import com.juyu.miliao.common.dataSource.tool.distributeOperate.DistributeOperate;

@Repository
public class FollowDao {
	@Autowired
	private SqlSession sqlSession;

/*	public List<Integer> getFollowIdsById(int id, int startNum, int pageSize){
		Map<String, Object> params = new HashMap<>();
		params.put("id", id);
		params.put("startNum", startNum);
		params.put("pageSize", pageSize);
		return sqlSession.selectList("getFollowIdsById", params);
	}*/
	
	//切面注解
	@DistributeOperate(value = "strategy('byUserId', #userIds)", resultHandler = "sortByUserIds(#userIds)")
	public List<User> getFollowById(Collection<Long> userIds){
		return sqlSession.selectList("getFollowById", Collections.singletonMap("userIds", userIds));
	}

    /*public int insertFollow(Follow entity){
		return sqlSession.insert("insertFollow", entity);
	}

	public int deleteFollow(Follow entity){
		return sqlSession.delete("deleteFollow", entity);
	}

	public int countFollow(int userId, int followUserId){
		Map<String, Object> params = new HashMap<>();
		params.put("userId", userId);
		params.put("followUserId", followUserId);
		return sqlSession.selectOne("countFollow", params);
	}

	public List<Integer> getFansById(int id, int startNum, int pageSize){
		Map<String, Object> params = new HashMap<>();
		params.put("id", id);
		params.put("startNum", startNum);
		params.put("pageSize", pageSize);
		return sqlSession.selectList("getFansById", params);
	}*/

}
